/**
 * @function namespace/signatrue - Component type : Control type : Parser.formskin : Parser.impl : html
 * conf - configuration properties for layout
 * prop - properties
 * parentconf - parent element conf
 * parentprop - parent element prop
 */
/*Parser["control:textarea:default:Json2htmlParser:html"] = function(conf, prop, parentconf, parentprop) {
	Parser.log(JSON.stringify(parentconf));
	Parser.log(JSON.stringify(parentprop));
	return '<span class="label"'+
			(prop["i18ntip-"+Parser.lang] ? (' original-title="'+prop["i18ntip-"+Parser.lang]+'"') : '')
			+ '>'
			+ (required ? '<span class="xh">*</span>' : '')
			+ prop["i18nname-" + Parser.lang] + '</span>'
			+ '<span class="item"><textarea '
			+ (prop.disabled=='1' ? ' readonly="readonly"' : '')
			+ (prop.style ? ' style="'+prop.style+'"' : '')
			+ (' class="area '+(prop.classNames ? prop.classNames : '')+'"')
			+ ' databinding="'+ prop.databinding+'"'
			+ (prop.processbinding ? ' binding="'+ prop.processbinding+ '"' : '')
			+ ' rows="'+(prop.rows||'1')+'" maxlength="'+ prop.maxlength +'"'
			+ ' ng-model="b.'+prop.databinding+'"'
			+ ' ng-bind="b.'+prop.databinding+'"'
			+ ' id="' + conf.id +'"'
			+ ' desc="'+ prop["i18nname-" + Parser.lang] +'"'
			+ ' name="' + conf.id+ '"></textarea></span>';
};*/

/*Parser["control:textarea:bootstrap-blue:Json2htmlParser:html"] = function(conf, prop, parentconf, parentprop) {
	Parser.log(JSON.stringify(parentconf));
	Parser.log(JSON.stringify(parentprop));
	var fmdcols = parseInt(parentconf.fmdcols);
	var cols = [1,fmdcols-1];
	if(fmdcols>3) {
		cols = [2,fmdcols-2];
	}
	return '<div class="col-md-'+cols[0]+'">'+
		    '<p'+
		    (prop["i18ntip-"+Parser.lang] ? (' original-title="'+prop["i18ntip-"+Parser.lang]+'"') : '') +
		    '>'+prop["i18nname-"+Parser.lang]+
		    (required ? '<span class="xh">*</span>' : '') +
		    '</p>'+
		    '</div>'+
		    '<div class="col-md-'+cols[1]+'">'
			+ '<textarea '
			+ (prop.disabled=='1' ? ' readonly="readonly"' : '')
			+ (prop.style ? ' style="'+prop.style+'"' : '')
			+ (' class="form-control '+(prop.classNames ? prop.classNames : '')+'"')
			+ ' databinding="'+ prop.databinding+'"'
			+ (prop.processbinding ? ' binding="'+ prop.processbinding+ '"' : '')
			+ ' rows="'+(prop.rows||'1')+'" maxlength="'+ prop.maxlength +'"'
			+ ' ng-model="b.'+prop.databinding+'"'
			+ ' ng-bind="b.'+prop.databinding+'"'
			+ ' placeholder="'+(prop.placeholder?prop.placeholder:'')+'"'
			+ ' id="' + conf.id +'"'
			+ ' desc="'+ prop["i18nname-" + Parser.lang] +'"'
			+ ' name="' + conf.id+ '"></textarea></div>';
};*/


/*Parser["control:textarea:default:Json2htmlParser:html"] = function(confs) {
	var s = "";
	for (var c in confs) {
		var conf = confs[c];
		var prop = conf.id ? Parser.props[conf.id] : {};
		Parser.log(JSON.stringify(conf));
		Parser.log(JSON.stringify(prop));
		s += '<span class="label"'+
			(prop["i18ntip-"+Parser.lang] ? (' original-title="'+prop["i18ntip-"+Parser.lang]+'"') : '')
			+ '>'
			+ (required ? '<span class="xh">*</span>' : '')
			+ prop["i18nname-" + Parser.lang] + '</span>'
			+ '<span class="item"><textarea '
			+ (prop.disabled=='1' ? ' readonly="readonly"' : '')
			+ (prop.style ? ' style="'+prop.style+'"' : '')
			+ (' class="area '+(prop.classNames ? prop.classNames : '')+'"')
			+ ' databinding="'+ prop.databinding+'"'
			//+ (prop.processbinding ? ' binding="'+ prop.processbinding+ '"' : '')
			+ ' rows="'+(prop.rows||'1')+'" maxlength="'+ prop.maxlength +'"'
			+ ' ng-model="b.'+prop.databinding+'"'
			+ ' ng-bind="b.'+prop.databinding+'"'
			+ ' id="' + conf.id +'"'
			+ ' desc="'+ prop["i18nname-" + Parser.lang] +'"'
			+ ' name="' + conf.id+ '"></textarea></span>';
	}
	return s;
};*/

Parser["control:textarea:bootstrap-blue:Json2htmlParser:html"] = function(confs) {
	var s = "";
	for (var c in confs) {
		var conf = confs[c];
		var prop = conf.id ? Parser.props[conf.id] : {};
		Parser.log(JSON.stringify(conf));
		Parser.log(JSON.stringify(prop));
		var required = Parser.parseValidator(conf.id);
		Parser.parseI18ntip(conf.id);
		var data = {};
		data.style = Parser.cssDisplay(prop.display)+(prop.style?prop.style:"");
		var transform = {"tag":"i"};
		var fmdcols = parseInt(conf.fmdcols);
		var cols = [1,fmdcols-1];
		if(fmdcols>3) {
			cols = [2,fmdcols-2];
		}
		transform.html = '<div class="col-md-'+cols[0]+'">'+
		    '<p'+
		    (prop["i18ntip-"+Parser.lang] ? (' title="'+prop["i18ntip-"+Parser.lang]+'"') : '') +
		    (prop.hideLabel=='1' ? ' style="display:none;"' : '')+
		    '>'+prop["i18nname-"+Parser.lang]+
		    (required ? '<span class="xh">*</span>' : '') +
		    (prop["i18ntip-"+Parser.lang] ? ('&nbsp;<i class="glyphicon glyphicon-question-sign"></i>') : '')+
		    '</p>'+
		    '</div>'+
		    '<div class="col-md-'+cols[1]+'">'
			+ '<textarea '
			+ (prop.disabled=='1' ? ' readonly="readonly"' : '')
			+ (data.style ? ' style="'+data.style+'"' : '')
			+ (' class="form-control '+(prop.classNames ? prop.classNames : '')+'"')
			+ ' databinding="'+ prop.databinding+'"'
			//+ (prop.processbinding ? ' binding="'+ prop.processbinding+ '"' : '')
			+ ' rows="'+(prop.rows||'1')+'" maxlength="'+ prop.maxlength +'"'
			+ ' ng-model="b.'+prop.databinding+'"'
			//+ ' ng-bind="b.'+prop.databinding+'"'
			+ ' placeholder="'+(prop.placeholder?prop.placeholder:'')+'"'
			+ ' id="' + conf.id +'"'
			+ ' desc="'+ prop["i18nname-" + Parser.lang] +'"'
			+ ' name="' + conf.id+ '"></textarea></div>';
		var wrapper = json2html.transform(data, transform);
		s += wrapper.substr(0, wrapper.length-4).substr(3);
	}
	return s;
};

Parser["control:textarea:default:Json2htmlParser:html"] = function(confs) {
	var s = "";
	for (var c in confs) {
		var conf = confs[c];
		var prop = conf.id ? Parser.props[conf.id] : {};
		Parser.log(JSON.stringify(conf));
		Parser.log(JSON.stringify(prop));
		var required = Parser.parseValidator(conf.id);
		Parser.parseI18ntip(conf.id);
		var data = {};
		data.style = Parser.cssDisplay(prop.display)+(prop.style?prop.style:"");
		var transform = {"tag":"i"};
		var fmdcols = parseInt(conf.fmdcols);
		var cols = [1,fmdcols-1];
		if(fmdcols>3) {
			cols = [2,fmdcols-2];
		}
		transform.html =  '<span class="label col-md-'+cols[0]+'"'
							+ (data.style ? ' style="'+data.style+'"' : '')
							+"><p"
							+ (prop["i18ntip-"+Parser.lang] ? (' title="'+prop["i18ntip-"+Parser.lang]+'"') : '')
							+ (prop.hideLabel=='1' ? ' style="display:none;"' : '')
							+ '>'
							+ (required ? '<span class="xh">*</span>' : '')
							+ prop["i18nname-" + Parser.lang] 
							+ (prop["i18ntip-"+Parser.lang] ? ('&nbsp;<i class="glyphicon glyphicon-question-sign"></i>') : '')
							+ '</p></span>'
							+ '<span class="item cellborder col-md-'+cols[1]+'"'
							+ (data.style ? ' style="'+data.style+'"' : '')
							+ '><textarea '
							+ (prop.disabled=='1' ? ' readonly="readonly"' : '')
							+ (prop.style ? ' style="'+prop.style+'"' : '')
							+ (' class="form-control '+(prop.classNames ? prop.classNames : '')+'"')
							+ ' databinding="'+ prop.databinding+'"'
							//+ (prop.processbinding ? ' binding="'+ prop.processbinding+ '"' : '')
							+ ' rows="'+(prop.rows||'1')+'" maxlength="'+ prop.maxlength +'"'
							+ ' ng-model="b.'+prop.databinding+'"'
							//+ ' ng-bind="b.'+prop.databinding+'"'
							+ ' id="' + conf.id +'"'
							+ ' desc="'+ prop["i18nname-" + Parser.lang] +'"'
							+ ' name="' + conf.id+ '"'
							+ '></textarea></span>';
		var wrapper = json2html.transform(data, transform);
		s += wrapper.substr(0, wrapper.length-4).substr(3);
	}
	return s;
};